import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image } from '@tarojs/components'
import { AtList, AtListItem } from "taro-ui"
import './projectpersonal.css'
import reactMixin from 'react-mixin';
import myJs from './projectpersonalJs.js'
import app from '../../../../main.js'

export default class ProjectPersonal extends Component {

  config = {
    navigationBarTitleText: '项目个人进度'
  }
  constructor() {
    super(...arguments);
    this.state = this.getData();
  }
  init() { }

  medicalDetails = () => {
    app.redirectTo('../chakanbingli1/chakanbingli1');
  }

  render() {
    return (
      <View className='project-personal'>
        {this.state.projects.items.map((item) =>
          <View className='project'>
            <Image className='project-img' src={item.image}></Image>
            <View className='project-title'>{item.name}</View>
            <View className='project-footer at-row'>
              <View className='at-col at-col-1 at-col--auto text'><Image src={app.imageUri + 'img/shijian.png'} className='f-img'></Image>{item.end_time}</View>
              <View className='at-col at-col-1 at-col--auto text'><Image src={app.imageUri + 'img/renshu.png'} className='f-img'></Image>{item.learder}</View>
              <View className='at-col at-col-1 at-col--auto text'><Image src={app.imageUri + 'img/bingli.png'} className='f-img'></Image>{item.case_amount}</View>
              <View className='at-col at-col-1 at-col--auto text'><Image src={app.imageUri + 'img/zhuangtai.png'} className='f-img'></Image>{item.status}</View>
            </View>
          </View>
        )}

        <AtList>
          <AtListItem title='项目个人患者' className='title' />
          {this.state.project_cases.items.map((item) =>
          <AtListItem title={item.projects_id_from_project_id_name+':'+item.title} extraText={item.status} note={'上传日期：'+item.updated_at} onClick={this.medicalDetails} />
        )}
        </AtList>

      </View>
    )
  }
}
reactMixin.onClass(ProjectPersonal, myJs);
